package com.masterclient.app.modules.order;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

import com.masterclient.app.R;

/**
 * 作者：sean
 * 创建时间：2017/9/11 18:25
 * 功能说明：
 */

public class NoticeDialog extends Dialog{


    String title;
    TextView tv_confirm;
    public NoticeDialog(@NonNull Context context,String title) {
        super(context, R.style.MyDialog);
        this.title = title;
    }

    private TextView tvTitle;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_notice);
        setCanceledOnTouchOutside(true);
        tvTitle = (TextView) findViewById(R.id.tv_title);
        tv_confirm = (TextView) findViewById(R.id.tv_confirm);
        tvTitle.setText(title);
        tv_confirm.setOnClickListener(v->{
            dismiss();
        });
    }


    @Override
    protected void onStart() {
        super.onStart();
        Window window = getWindow();
        WindowManager.LayoutParams windowparams = window.getAttributes();
        window.setGravity(Gravity.CENTER);
        window.setBackgroundDrawableResource(android.R.color.transparent);
        window.setAttributes(windowparams);
    }

}
